import pytest
import os
from common.Yaml import Yaml
from common.Request import Request
from common.Path import project_path
good_yaml_file=project_path()

good_yaml_file=os.path.join(good_yaml_file,"api", "goods", "good.yaml")
good_yaml_data = Yaml(good_yaml_file).read_yaml()
base_url=good_yaml_data['base_url']
url=good_yaml_data['url']
test_case=good_yaml_data['test_cases'][0]
json_dict={'reqBody':'','pageNo':1,'pageSize':100}
reqBody=test_case['reqBody']
json_dict['reqBody']=reqBody
req=Request(base_url)
print(json_dict)

#@pytest.mark.parametrize("test_case",good_yaml_data['test_cases'])


def test_good():
    response=req.send_request(method=test_case['method'],url=base_url+url,json=json_dict,headers=good_yaml_data['headers']).json()
    assert response['data']['totalNo']==2







'''
if __name__=='__main__':
    pytest.main(['-vs'])
    '''




